package org.example.controller;

import org.example.domain.OrderDomain;
import org.example.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/orders")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @ResponseBody
    @GetMapping("/{orderId}")
    public OrderDomain getOrderById(@PathVariable Long orderId) {
        return orderService.getOrderById(orderId);
    }

    @ResponseBody
    @PostMapping("/{orderId}")
    public Boolean saveOrder(@RequestBody OrderDomain order) {
        orderService.createOrder(order);
        return true;
    }



}
